package com.cetc39.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cetc39.bean.NodeType;
import com.cetc39.dao.NodeTypeDao;

public class NodeTypeDaoImpl extends HibernateDaoSupport implements NodeTypeDao {

	@Override
	public void save(NodeType nt) {
		this.getHibernateTemplate().save(nt);
	}

	@Override
	public void update(NodeType nt) {
		this.getHibernateTemplate().saveOrUpdate(nt);
	}

	@Override
	public List<?> findAll() {
		List<?> nodeTypeList = this.getHibernateTemplate().find("FROM NodeType");
		return nodeTypeList;
	}

	@Override
	public NodeType findById(int id) {
		NodeType nt = this.getHibernateTemplate().get(NodeType.class, id);
		return nt;
	}

	@Override
	public void delete(int id) {
		NodeType nt = this.getHibernateTemplate().get(NodeType.class, id);
		this.getHibernateTemplate().delete(nt );
	}

}
